package com.example.icedcap.topeka_fake.widget.outlineprovider;

import android.graphics.Outline;
import android.view.View;
import android.view.ViewOutlineProvider;

/**
 * Created by doushuqi on 15-7-9下午10:16.
 * Email:doushuqi0409@gmail.com
 */
public class RoundOutlineProvider extends ViewOutlineProvider{
    private final int mSize;
    @Override
    public void getOutline(View view, Outline outline) {
//        final int size = view.getResources().getDimensionPixelSize(getSizeResourceId());
        outline.setOval(0, 0, mSize, mSize);
    }

    public RoundOutlineProvider(final int size) {
        if (0 > size) {
            throw new IllegalArgumentException("size need to be > 0. Actually was " + size);
        }
        mSize = size;
    }

    /**
     * Implementations need to provider a dimension resource which is used as the outline's size.
     * @return
     */
//    public abstract int getSizeResourceId();
}
